<%@ page language="java" contentType="text/html; charset=UTF-8"
	pageEncoding="UTF-8"%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<meta name="renderer" content="webkit">
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
<meta name="viewport"
	content="width=device-width, initial-scale=1, maximum-scale=1">
<title>Insert title here</title>
<link rel="stylesheet" type="text/css"
	href="${pageContext.request.contextPath}/layui/css/layui.css"
	media="all">
<script type="text/javascript" charset="utf-8"
	src="${pageContext.request.contextPath}/layui/layui.js"></script>
<!-- layui/dist/layui.js" charset="utf-8" -->

<!--  <link rel="stylesheet" href="//res.layui.com/layui/dist/css/layui.css"  media="all"> -->
<%--  <link rel="stylesheet" href="${pageContext.request.contextPath}op/layui/css/layui.css"  media="all"> --%>
</head>
<body>
	<form class="layui-form"
		action="${pageContext.request.contextPath}/AddGoods"
		enctype="multipart/form-data" method="post">

		<div class="layui-form-item">
			<label class="layui-form-label">商品名称</label>
			<div class="layui-input-block">
				<input type="text" name="good_name" placeholder="请输入商品名称"
					class="layui-input">
			</div>
		</div>

		<div class="layui-form-item">
			<div class="layui-inline">
				<label class="layui-form-label">上架日期</label>
				<div class="layui-input-inline">
					<input type="text" name="time" id="date" lay-verify="date"
						placeholder="yyyy-MM-dd" autocomplete="off" class="layui-input">
				</div>
			</div>
			<div class="layui-inline">
				<label class="layui-form-label">库存数量</label>
				<div class="layui-input-inline">
					<input type="text" name="quantity" class="layui-input">
				</div>
			</div>
		</div>

		<div class="layui-form-item">
			<div class="layui-inline">
				<label class="layui-form-label">销售价格</label>
				<div class="layui-input-inline" style="width: 100px;">
					<input type="text" name="good_price" placeholder="￥"
						class="layui-input">
				</div>
			</div>
		</div>

		<div class="layui-inline">


			<label class="layui-form-label">商品类型</label>
			<div class="layui-input-inline">

				<select name="type_name">
					<c:forEach var="it" items="${list}">

						<option value="${it.type_name}">${it.type_name}</option>

					</c:forEach>
				</select>
			</div>
		</div>

		<div class="layui-form-item">
			<label class="layui-form-label">出厂地址</label>
			<div class="layui-input-inline">
				<select name="supplier">
					<option value="">请选择省</option>
					<option value="浙江">浙江省</option>
					<option value="你的工号">江西省</option>
					<option value="你最喜欢的老师">福建省</option>
				</select>
			</div>
			<div class="layui-input-inline">
				<select name="supplier">
					<option value="">请选择市</option>
					<option value="杭州">杭州</option>
					<option value="宁波">宁波</option>
					<option value="温州">温州</option>
					<option value="温州">台州</option>
					<option value="温州">绍兴</option>
				</select>
			</div>
			<div class="layui-input-inline">
				<select name="supplier">
					<option value="">请选择县/区</option>
					<option value="西湖区">西湖区</option>
					<option value="余杭区">余杭区</option>
					<option value="拱墅区">临安市</option>
				</select>
			</div>
			<div class="layui-form-mid layui-word-aux"></div>
		</div>

		<div class="layui-form-item layui-form-text"
			style="width: 600px; height: 60px;">
			<label class="layui-form-label">商品展示</label>
			<div class="layui-input-block">
				<input type="file" onchange=" " placeholder="请输入内容"
					class="layui-textarea"> <img id="img" src=" ">
			</div>
		</div>

		<div class="layui-form-item layui-form-text" style="margin-top: 50px;">
			<label class="layui-form-label">商品简介</label>
			<div class="layui-input-block">
				<textarea class="layui-textarea layui-hide" name="good_desc"
					lay-verify="content" id="LAY_demo_editor"></textarea>
			</div>
		</div>

		

		<fieldset class="layui-elem-field layui-field-title"
			style="margin-top: 30px;">
			<legend>指定允许上传的文件类型</legend>
		</fieldset>

		<fieldset class="layui-elem-field layui-field-title"
			style="margin-top: 30px;">
			<legend>上传多张图片</legend>
		</fieldset>
		<div class="layui-upload">
			<button type="button" class="layui-btn" id="test2">多图片上传</button>
			<blockquote class="layui-elem-quote layui-quote-nm"
				style="margin-top: 10px;">
				预览图：
				<div class="layui-upload-list" id="demo2"></div>
			</blockquote>
		</div>



		<div class="layui-form-item">
			<div class="layui-input-block">
				<button type="submit" class="layui-btn">立即提交</button>
				<button type="reset" class="layui-btn layui-btn-primary">重置</button>
			</div>
		</div>
	</form>

	<script>
	
	 //多图片上传
	  upload.render({
	    elem: '#test2'
	    ,url: 'https://httpbin.org/post' //改成您自己的上传接口
	    ,multiple: true
	    ,before: function(obj){
	      //预读本地文件示例，不支持ie8
	      obj.preview(function(index, file, result){
	        $('#demo2').append('<img src="'+ result +'" alt="'+ file.name +'" class="layui-upload-img">')
	      });
	    }
	    ,done: function(res){
	      //上传完毕
	    }
	  });
	
	
		layui
				.use(
						[ 'form', 'layedit', 'laydate' ],
						function() {
							var form = layui.form, layer = layui.layer, layedit = layui.layedit, laydate = layui.laydate;

							//日期
							laydate.render({
								elem : '#date'
							});
							laydate.render({
								elem : '#date1'
							});

							//创建一个编辑器
							var editIndex = layedit.build('LAY_demo_editor');

							/* //自定义验证规则
							form.verify({
								title : function(value) {
									if (value.length < 1) {
										return '请输入商品名称';
									}
								},
								pass : [ /^[\S]{6,12}$/, '密码必须6到12位，且不能出现空格' ],
								content : function(value) {
									layedit.sync(editIndex);
								}
							});
							 */

							/* //监听提交
							form.on('submit(demo1)', function(data) {
								layer.alert(JSON.stringify(data.field), {
									title : '最终的提交信息'
								})
								return false;
							}); */

							/* //表单赋值
							layui.$('#LAY-component-form-setval').on('click',
									function() {
										form.val('example', {
											"username" : "贤心" // "name": "value"
											,
											"password" : "123456",
											"interest" : 1,
											"like[write]" : true //复选框选中状态
											,
											"close" : true //开关状态
											,
											"sex" : "女",
											"desc" : "我爱 layui"
										});
									}); */

							//表单取值
							layui.$('#LAY-component-form-getval').on('click',
									function() {
										var data = form.val('example');
										alert(JSON.stringify(data));
									});

						});
	</script>


	<!-- <script>
		//Demo
		layui.use('form', function() {
			var form = layui.form;

			//监听提交
			form.on('submit(formDemo)', function(data) {
				layer.msg(JSON.stringify(data.field));
				return false;
			});
		});
	</script>
 -->


</body>
</html>